﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class ChucNang_Admin_Admin_ThemDoiTac : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnThem_Click(object sender, EventArgs e)
    {
        DataDSTableAdapters.DOITACTableAdapter dtadapter = new DataDSTableAdapters.DOITACTableAdapter();
        int? kq = 0;
        string imageFolder = ConfigurationSettings.AppSettings["IMAGE_FOLDER"];
        string tenDoiTac = txtTenDoiTac.Text;
        string maTaiKhoanNganHang = txtMaTaiKhoanNganHang.Text;
        string maThue = txtMaThue.Text;
        string diaChi= txtDiaChi.Text;
        string dienThoai = txtDienThoai.Text;
        string nguoiDaiDien = txtNguoiDaiDien.Text; ;
        string website = txtWebsite.Text;      
         
        dtadapter.DOITAC_Them(tenDoiTac, imageFolder + FileUploadLogo.FileName, maTaiKhoanNganHang, maThue, diaChi, dienThoai, nguoiDaiDien, website, ref kq);
        string strFilename;
        if (FileUploadLogo.FileName != "")
        {
            strFilename = Server.MapPath(imageFolder + FileUploadLogo.FileName);
            FileUploadLogo.PostedFile.SaveAs(strFilename);
        }
        if (kq == 0)
            Response.Write("<script>alert('Thêm đối tác thành công');location.href='Admin_XemDanhSachDoiTac.aspx';</script>");
        else
            Response.Write("<script>alert('Thêm đối tác không thành công');location.href='Admin_XemDanhSachDoiTac.aspx';</script>");
        
    }
}
